/*
 * Copyright (c) 2023 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef CHIP_PCA9555_H
#define CHIP_PCA9555_H

#include "internal/bus/bus_base/bus.h"
#include "internal/chip/chip_base/chip.h"
#include <mc/engine.h>
#include <memory>

#define IO0_CONFIG_REG 6
#define IO1_CONFIG_REG 7
#define IO0_OUTPUT_REG 2
#define IO1_OUTPUT_REG 3

namespace dev {

class chip_pca9555 : public chip_base {
public:
    bool     init(mc::mutable_dict& csr_object);
    int32_t bit_write(uint32_t offset, uint8_t length, uint32_t mask,
                       const std::vector<uint8_t>& in_buffer,
                       std::vector<uint8_t>&       out_buffer, std::string& error) override;
};

} // namespace dev

#endif // CHIP_PCA9555_H